//
//  SleepMode.m
//  uteped_sdk
//
//  Created by mateng on 2024/2/28.
//

#import "SleepModel.h"

@implementation SleepModel

- (void)from:(UTEModelSciSleepFileData *)data {
    self.sleepTime = data.sleepTime;
    self.sleepType = data.sleepType;
    self.isSnooze = (data.sleepType == 6);
    self.startTime = [DateUtils timeToInt:data.startTime fmt:FMT_TIME_NORMAL];
    self.endTime = [DateUtils timeToInt:data.endTime fmt:FMT_TIME_NORMAL];
    self.calendarTime = [DateUtils timeStampToString:self.startTime fmt:FMT_TIME_CLANDER_TIME];
    self.calendar = [DateUtils timeStampToString:self.startTime fmt:FMT_TIME_CLANDER];
    
    [self.storeData setObject:@(self.sleepTime) forKey:@"sleep_time"];
    [self.storeData setObject:@(self.sleepType) forKey:@"sleep_type"];
    [self.storeData setObject:@(self.isSnooze) forKey:@"is_snooze"];
    [self.storeData setObject:@(self.startTime) forKey:@"start_time"];
    [self.storeData setObject:@(self.endTime) forKey:@"end_time"];
    [self.storeData setObject:self.calendarTime forKey:@"calendar_time"];
    [self.storeData setObject:self.calendar forKey:@"calendar"];
}

@end
